#!/bin/bash
set +e;
source experiment.cfg
i=0;
cat $node_dns_file | while read line; 
do
    i=`expr $i + 1`;
    scp -i $key_file -o StrictHostKeyChecking=no ec2-user@${line}:*.log ./logs/ 2> /dev/null
    echo "Copied logs from ${line}"; 
    ssh -i $key_file -o StrictHostKeyChecking=no ${line} rm -f *.log &
    echo "Removed logs from ${line}";
done